package org.testmyapp.entities;

import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

public class BillPk {

	public Integer accountingMedical;
	public Integer billNr;

	public BillPk() {

	}

	public BillPk(Integer accountingMedical, int billNr) {
		this.accountingMedical = accountingMedical;
		this.billNr = billNr;
	}

	@Override
	public boolean equals(Object other) {
		if (other == null) {
			return false;
		}
		if (!other.getClass().equals(this.getClass())) {
			return false;
		}
		BillPk otherObject = (BillPk) other;
		if (otherObject == this) {
			return true;
		}
		if (accountingMedical != null && otherObject.accountingMedical != null
				&& accountingMedical.equals(otherObject.accountingMedical)) {
			if (billNr != null && otherObject.billNr != null
					&& billNr.equals(otherObject.billNr)) {
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		if(accountingMedical == null || billNr == null) {
			return 0;
		}
		else {
			return accountingMedical.hashCode() ^ billNr.hashCode();
		}
	}

}
